import axiosIns, { axiosOdata } from '../utils/axios';
import { detailData, typeData } from '../utils/mock';

/**
|--------------------------------------------------
| Constants
|--------------------------------------------------
*/
const REVERSEINFO = 'REVERSEINFO';
const CLEARREVERSEINFO = 'CLEARREVERSEINFO';
/**
|--------------------------------------------------
| Actions
|--------------------------------------------------
*/
export function reserverInfo(params) {
  return {
    type: REVERSEINFO,
    info: params
  };
}
export function clearReverseInfo(params) {
  return {
    type: CLEARREVERSEINFO,
    info: null
  };
}
/**
|--------------------------------------------------
| Action Handlers
|--------------------------------------------------
*/
const ACTION_HANDLERS = {
  [REVERSEINFO]: (state, action) => {
    return { ...state, reverseInfo: action.info };
  },
  [CLEARREVERSEINFO]: (state, action) => {
    return { ...state, reverseInfo: action.info };
  }
};
/**
|--------------------------------------------------
| Reducer
|--------------------------------------------------
*/
export const initialState = {
  reverseInfo: null
};

export default function(state = initialState, action) {
  const handler = ACTION_HANDLERS[action.type];

  return handler ? handler(state, action) : state;
}
